package cn.edu.sdjzu.xg.eagle.util;


import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ConfigUtil {
    private static Properties properties;

    static {
        try {
            properties = new Properties();
            InputStream inputStream = ConfigUtil.class.getClassLoader()
                    .getResourceAsStream("config.properties");
            if (inputStream == null) {
                throw new RuntimeException("config.properties file not found in classpath");
            }
            properties.load(inputStream);
        } catch (IOException e) {
            throw new RuntimeException("Failed to load config.properties", e);
        }
    }

    public static String getProperty(String key) {
        return properties.getProperty(key);
    }
}
